﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace sharpCmd.Modules.FileSystem
{
    class FileSystemModule:IFileSystemModule
    {
        public static FileSystemModule Instance { get; private set; }
        static FileSystemModule()
        {
            Instance = new FileSystemModule();
        }

        /// <summary>
        /// Gets size of a directory, in bytes
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public long GetDirectorySize(string path)
        {
            DirectoryInfo info = new DirectoryInfo(path);
            return info.GetFiles("*", SearchOption.AllDirectories).Sum(p => p.Length);
        }
    }
}
